- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 5.3k
 
Clarified Default and ClassName groups #3593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| 
           btw, also fixed some grammar in the Group Sequence Provider section  | 
    
| 
           Thank you very much for that.  | 
    
        
          
                book/validation.rst
              
                Outdated
          
        
      There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO this is the wrong order. All constraints belong to the "Default" group first and foremost. "User" is just an alias for the constraints in the "Default" group of the User class. That means, for example:
class User extends Person
{
    /**
     * @Assert\Valid
     * @Assert\Type("Acme\Address")
     */
    private $address;
}- When I validate a 
Userobject in the "Default" group, all default constraints of both theUserand theAddresswill be validated. - When I validate it in the "User" group, only the default constraints of the 
Userclass (and superclasses) will be executed - When I validate it in the "Address" group, only the default constraints of the 
Addressclass will be executed. - When I validated it in the "Person" group, only the default constraints of the 
Personclass (and superclasses) will be executed. 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw, you should use CamelCaps notation for group names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About your first comment: Thanks a lot for creating such a nice real world examples! :) It helps me a lot to understand the topic. I think I've covered it now in the updated list.
And your second comment: I can't see a place where I don't use CamelCaps?
| 
           Thanks for clarifying @wouterj!  | 
    
| 
           This is much better explained! Though I'll admit, the subtleties between the Default and User stuff makes my head spin a little bit still.  | 
    
This PR was merged into the 2.3 branch. Discussion ---------- Clarified Default and ClassName groups This is still the most difficult part of the validation groups and we don't put much attention on it. I've refactored it a bit after the really great explaination of @webmozart. For more information see: symfony/symfony#10287 (comment) | Q | A | --- | --- | Doc fix? | yes | New docs? | yes | Applies to | all | Fixed tickets | - Commits ------- b6357fa Updated after review of @webmozart 2330cd8 Clarified Default vs ClassName groups
This is still the most difficult part of the validation groups and we
don't put much attention on it. I've refactored it a bit after the
really great explaination of @webmozart.
For more information see: symfony/symfony#10287 (comment)